package com.motu.vertx.module.utility.webhandler;

import com.motu.vertx.module.utility.webtool.BaseWebHandler;
import com.motu.vertx.module.utility.webtool.SearchCondition;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.web.RoutingContext;
import io.vertx.ext.web.client.WebClient;
import io.vertx.sqlclient.Pool;

import java.util.ArrayList;
import java.util.List;

public class BanneduserHandler extends BaseWebHandler{
	public static final String tableName = "banneduser";
	private static Pool jdbcClientServer = null;

	public static void init(Pool jdbcServer){
		jdbcClientServer = jdbcServer;
	}
	public static void list(RoutingContext routingContext,JsonObject json,String adminName,WebClient client){
		getTableList(routingContext, jdbcClientServer,tableName);
	}
	public static void add(RoutingContext routingContext,JsonObject json,String adminName,WebClient client){
		addToTable(routingContext,jdbcClientServer, tableName,null);
	}

	public static void update(RoutingContext routingContext,JsonObject json,String adminName,WebClient client){
		
		updateToTable(routingContext,jdbcClientServer, tableName,null);
	}

	public static void getone(RoutingContext routingContext,JsonObject json,String adminName,WebClient client){
		getFromTable(routingContext,jdbcClientServer, tableName);

	}
	public static void delete(RoutingContext routingContext,JsonObject json,String adminName,WebClient client){
		deleteFromTable(routingContext,jdbcClientServer, tableName);
	}

	//创角ip限制记录查询
	public static void iplimit_search(RoutingContext routingContext,JsonObject json,String adminName,WebClient client){
		List<SearchCondition> scList = new ArrayList<SearchCondition>();
		scList.add(new SearchCondition("ip", "=", null, null));
		searchFromTable(routingContext, jdbcClientServer, json, "iplimitrecord", scList);
	}
	

}
